﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace LowLevelGraphics.ImageFormats.SVG.Shapes
{
    /// <summary>
    /// Ellipse
    /// </summary>
    public class Ellipse : Circle
    {
        protected float m_nR2 = -1;

        /// <summary>
        /// Initializes a new instance of the <see cref="Ellipse"/> class.
        /// </summary>
        public Ellipse()
        { 
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Ellipse"/> class.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        /// <param name="r1">The r1.</param>
        /// <param name="r2">The r2.</param>
        public Ellipse(float x, float y, float r1, float r2)
            : base(x,y,r1)
        {
            this.Location = new PointF(x, y);
            this.Radius = r1;
            this.Radius2 = r2;
        }

        /// <summary>
        /// Gets or sets the radius2.
        /// </summary>
        /// <value>The radius2.</value>
        public float Radius2
        {
            get { return m_nR2; }
            set { m_nR2 = value; }
        }

        public override void Draw(Graphics g)
        {
            if (m_Style.FillColor != Color.Transparent)
            {
                Brush brush = new SolidBrush(m_Style.FillColor);
                g.FillEllipse(brush, this.X, this.Y, this.m_fRadius, this.m_nR2);
                brush.Dispose();
            }
            else
            {
                Pen pen = new Pen(new SolidBrush(m_Style.FillColor), m_Style.StrokeWidth);
                g.DrawEllipse(pen, this.X, this.Y, this.m_fRadius, this.m_nR2);
                pen.Dispose();
            }
        }
    }
}
